package com.jpa.web.service.impl;

import com.jpa.web.model.Employee;
import com.jpa.web.repository.EmployeeCrudRepository;
import com.jpa.web.service.EmployeeServiceCrud;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * Created by BKWJA on 2018/10/28.
 */
@Service
public class EmployeeServiceImplCrud implements EmployeeServiceCrud {

    @Autowired
    private EmployeeCrudRepository employeeCrudRepository;

    /**
     * 保存多个实体 添加多条记录
     * @param employees
     */
    @Override
    @Transactional
    public void save(List<Employee> employees) {
        employeeCrudRepository.saveAll(employees);
    }
}
